#ifndef quotationHandler_H
#define quotationHandler_H
#include <string>
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <fstream>

#include "quotation.hxx"
#include "quotationXsdFile.h"
#include "commonException.hpp"

class quotationHandler{
public:
	quotationHandler();
	quotationHandler(std::string xmlFile);
	~quotationHandler();

	void loadQuotationFile(std::string xmlFile);

	void printRandomQuote();
	void listAuthors();
	void printRandomQuoteFromAuthor(std::string authorName);

	void printRandomQuoteFromAuthorWithUI();

	void addQuotesWithUserInterface();

	size_t howManyQuotes();
	size_t howManyAuthors();

private:
	void addQuotes(quotation::quotes q);
	std::vector<std::string> getAuthorsVector();

	quotation::quotes getRandomQuotesFromAuthor(std::string authorName);
	quotation::quotes getRandomQuotes();

	void serialize();

	bool initDone;
	std::string m_xmlFile;
	std::auto_ptr<quotation::root> m_q;
	quotationXsdFile m_quotationXsdFile;

};


#endif
